namespace SubSonic
{
    using SubSonic.Utilities;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Configuration.Provider;
    using System.Data;
    using System.Data.Common;
    using System.Web.Configuration;

    public abstract class DataProvider : ProviderBase
    {
        [ThreadStatic]
        private static DbConnection __sharedConnection;
        private string _databaseVersion;
        private string _defaultConnectionString;
        private string additionalNamespaces = string.Empty;
        private string appendWith = string.Empty;
        private string connectionStringName;
        private string excludeProcedureList = string.Empty;
        private string excludeTableList = string.Empty;
        private bool extractClassNameFromSPName;
        private bool fixDatabaseObjectCasing = true;
        private bool fixPluralClassNames = true;
        private string generatedNamespace = "SubSonic.Generated";
        private bool generateLazyLoads;
        private bool generateNullableProperties = true;
        private bool generateODSControllers = true;
        private bool generateRelatedTablesAsProperties;
        private string includeProcedureList = "*";
        private string includeTableList = "*";
        private string manyToManySuffix = "_Map";
        private string regexDictionaryReplace = string.Empty;
        private bool regexIgnoreCase;
        private string regexMatchExpression = string.Empty;
        private string regexReplaceExpression = string.Empty;
        private string relatedTableLoadPrefix = string.Empty;
        private bool removeUnderscores = true;
        internal SortedList<string, TableSchema.Table> schemaCollection = new SortedList<string, TableSchema.Table>();
        private bool setPropertyDefaultsFromDatabase;
        private string spClassName = "SPs";
        private string spStartsWith = string.Empty;
        private string stripColumnText = string.Empty;
        private string stripParamText = string.Empty;
        private string stripSPText = string.Empty;
        private string stripTableText = string.Empty;
        private string stripViewText = string.Empty;
        private string[] tableNames;
        private bool useExtendedProperties;
        private bool useSPs = true;
        private string[] viewNames;
        private string viewStartsWith = string.Empty;

        protected DataProvider()
        {
        }

        private static void __sharedConnection_Disposed(object sender, EventArgs e)
        {
            __sharedConnection = null;
        }

        public void AddSchema(string tableName, TableSchema.Table schema)
        {
            if (!this.schemaCollection.ContainsKey(tableName))
            {
                this.schemaCollection.Add(tableName, schema);
            }
        }

        protected static void AddTableMappings(DataAdapter da, DataSet ds)
        {
            string str = "Table";
            string[] tableNames = GetTableNames(ds);
            for (int i = 0; i < tableNames.Length; i++)
            {
                string sourceTable = (i == 0) ? str : (str + i);
                da.TableMappings.Add(sourceTable, tableNames[i]);
            }
        }

        public static void AddWhereParameters(QueryCommand cmd, Query qry)
        {
            foreach (Where where in qry.wheres)
            {
                if ((where.ParameterValue != null) && (where.ParameterValue != DBNull.Value))
                {
                    cmd.AddParameter(where.ParameterName, where.ParameterValue, where.DbType);
                }
            }
            foreach (BetweenAnd and in qry.betweens)
            {
                cmd.AddParameter(and.StartParameterName, and.StartDate, DbType.DateTime);
                cmd.AddParameter(and.EndParameterName, and.EndDate, DbType.DateTime);
            }
            if ((qry.inList != null) && (qry.inList.Length > 0))
            {
                int num = 1;
                foreach (object obj2 in qry.inList)
                {
                    cmd.AddParameter("in" + num, obj2);
                    num++;
                }
            }
        }

        protected virtual string AdjustUpdateSql(Query qry, TableSchema.Table table, string updateSql)
        {
            return (updateSql + "; SELECT " + Utility.PrefixParameter(table.PrimaryKey.ColumnName, qry.Provider) + " AS id");
        }

        private static void ApplyConfig(NameValueCollection config, ref bool parameterValue, string configName)
        {
            if (config[configName] != null)
            {
                parameterValue = Convert.ToBoolean(config[configName]);
            }
        }

        private static void ApplyConfig(NameValueCollection config, ref string parameterValue, string configName)
        {
            if (config[configName] != null)
            {
                parameterValue = config[configName];
            }
        }

        public abstract QueryCommand BuildCommand(Query qry);
        public QueryCommand BuildDeleteCommand(Query qry)
        {
            string sql = "DELETE FROM " + Utility.QualifyColumnName(qry.Schema.SchemaName, qry.Schema.Name, qry.Provider);
            QueryCommand cmd = new QueryCommand(sql, qry.ProviderName);
            if (qry.UpdateSettings != null)
            {
                IDictionaryEnumerator enumerator = qry.UpdateSettings.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    TableSchema.TableColumn column = qry.Schema.GetColumn(enumerator.Key.ToString());
                    if (column != null)
                    {
                        cmd.AddParameter(enumerator.Key.ToString(), enumerator.Value, column.DataType);
                    }
                }
            }
            sql = sql + BuildWhere(qry);
            AddWhereParameters(cmd, qry);
            cmd.CommandSql = sql;
            return cmd;
        }

        public QueryCommand BuildSelectCommand(Query qry)
        {
            return BuildSelectCommand(this.GetSql(qry), qry);
        }

        public static QueryCommand BuildSelectCommand(string sql, Query qry)
        {
            QueryCommand cmd = new QueryCommand(sql, qry.ProviderName);
            AddWhereParameters(cmd, qry);
            return cmd;
        }

        public QueryCommand BuildUpdateCommand(Query qry)
        {
            TableSchema.Table schema = qry.Schema;
            if (qry.UpdateSettings == null)
            {
                throw new Exception("No update settings have been set. Use Query.AddUpdateSetting to add some in");
            }
            string sql = "UPDATE " + schema.Name;
            QueryCommand cmd = new QueryCommand(sql, qry.ProviderName);
            IDictionaryEnumerator enumerator = qry.UpdateSettings.GetEnumerator();
            string str2 = " SET ";
            bool flag = true;
            while (enumerator.MoveNext())
            {
                TableSchema.TableColumn column = schema.GetColumn(enumerator.Key.ToString());
                if (column == null)
                {
                    throw new Exception(string.Concat(new object[] { "There is no column in ", schema.Name, " called ", enumerator.Key }));
                }
                if (!flag)
                {
                    sql = sql + "," + Utility.MakeParameterAssignment(enumerator.Key.ToString(), enumerator.Key.ToString(), qry.Provider);
                }
                else
                {
                    flag = false;
                    sql = sql + str2 + Utility.MakeParameterAssignment(enumerator.Key.ToString(), enumerator.Key.ToString(), qry.Provider);
                    str2 = string.Empty;
                }
                cmd.AddParameter(enumerator.Key.ToString(), enumerator.Value, column.DataType);
            }
            sql = sql + BuildWhere(qry);
            AddWhereParameters(cmd, qry);
            cmd.CommandSql = sql;
            return cmd;
        }

        public static string BuildWhere(Query qry)
        {
            string str = string.Empty;
            string str2 = " WHERE ";
            bool flag = true;
            foreach (Where where in qry.wheres)
            {
                str2 = flag ? " WHERE " : (" " + Enum.GetName(typeof(Where.WhereCondition), where.Condition) + " ");
                str = str + str2 + Utility.QualifyColumnName(where.TableName, where.ColumnName, qry.Provider) + Where.GetComparisonOperator(where.Comparison);
                if ((where.ParameterValue != DBNull.Value) && (where.ParameterValue != null))
                {
                    str = str + Utility.PrefixParameter(where.ParameterName, qry.Provider);
                }
                else
                {
                    str = str + " NULL";
                }
                flag = false;
            }
            foreach (BetweenAnd and in qry.betweens)
            {
                if ((qry.wheres.Count == 0) && flag)
                {
                    str2 = " WHERE ";
                }
                else
                {
                    str2 = flag ? " WHERE " : (" " + Enum.GetName(typeof(Where.WhereCondition), and.Condition) + " ");
                }
                string str3 = str;
                str = str3 + str2 + Utility.QualifyColumnName(and.TableName, and.ColumnName, qry.Provider) + " BETWEEN " + Utility.PrefixParameter(and.StartParameterName, qry.Provider) + " AND " + Utility.PrefixParameter(and.EndParameterName, qry.Provider);
                flag = false;
            }
            for (int i = qry.wheres.Count - 1; i >= 0; i--)
            {
                if (qry.wheres[i].ParameterValue == DBNull.Value)
                {
                    qry.wheres.RemoveAt(i);
                }
            }
            if ((qry.inList != null) && (qry.inList.Length > 0))
            {
                if (flag)
                {
                    str = str + str2;
                }
                else
                {
                    str = str + " AND ";
                }
                str = str + qry.Provider.DelimitDbName(qry.inColumn) + " IN (";
                bool flag2 = true;
                for (int j = 1; j <= qry.inList.Length; j++)
                {
                    if (!flag2)
                    {
                        str = str + ", ";
                    }
                    flag2 = false;
                    str = str + Utility.PrefixParameter("in" + j, qry.Provider);
                }
                str = str + ")";
            }
            if (string.IsNullOrEmpty(qry.LogicalDeleteColumn))
            {
                return str;
            }
            if (qry.wheres.Count > 0)
            {
                string str4 = str;
                return (str4 + " AND (" + qry.LogicalDeleteColumn + " IS NULL OR " + qry.LogicalDeleteColumn + " = 0)");
            }
            string str5 = str;
            return (str5 + " WHERE (" + qry.LogicalDeleteColumn + " IS NULL OR " + qry.LogicalDeleteColumn + " = 0)");
        }

        internal abstract DbConnection CreateConnection();
        internal abstract DbConnection CreateConnection(string connectionString);
        public virtual string DelimitDbName(string columnName)
        {
            return columnName;
        }

        public abstract int ExecuteQuery(QueryCommand cmd);
        public abstract object ExecuteScalar(QueryCommand cmd);
        public abstract void ExecuteTransaction(QueryCommandCollection commands);
        public abstract IDbCommand GetCommand(QueryCommand qry);
        internal abstract string GetDatabaseVersion(string providerName);
        public virtual DataSet GetDataSet(QueryCommand cmd)
        {
            return this.GetDataSet<DataSet>(cmd);
        }

        public abstract T GetDataSet<T>(QueryCommand qry) where T: DataSet, new();
        public abstract DbCommand GetDbCommand(QueryCommand qry);
        public abstract DbType GetDbType(string dataType);
        public static string GetDeleteSql(Query qry)
        {
            TableSchema.Table schema = qry.Schema;
            string str = "DELETE FROM " + Utility.QualifyColumnName(schema.SchemaName, schema.Name, qry.Provider);
            if (qry.wheres.Count == 0)
            {
                TableSchema.TableColumn[] primaryKeys = schema.PrimaryKeys;
                for (int i = 0; i < primaryKeys.Length; i++)
                {
                    str = str + " WHERE " + Utility.MakeParameterAssignment(primaryKeys[i].ColumnName, primaryKeys[i].ColumnName, qry.Provider);
                    if ((i + 1) != primaryKeys.Length)
                    {
                        str = str + " AND ";
                    }
                }
                return str;
            }
            return (str + BuildWhere(qry));
        }

        public TableSchema.Table GetForeignKeyTable(TableSchema.TableColumn fkColumn, TableSchema.Table table)
        {
            string foreignKeyTableName = this.GetForeignKeyTableName(fkColumn.ColumnName, table.Name);
            if (!string.IsNullOrEmpty(foreignKeyTableName))
            {
                return DataService.GetSchema(foreignKeyTableName, this.Name, table.TableType);
            }
            return null;
        }

        public abstract string GetForeignKeyTableName(string fkColumnName);
        public abstract string GetForeignKeyTableName(string fkColumnName, string tableName);
        public abstract string[] GetForeignKeyTables(string tableName);
        public abstract string GetInsertSql(Query qry);
        public abstract string GetParameterPrefix();
        public abstract ArrayList GetPrimaryKeyTableNames(string tableName);
        public abstract TableSchema.Table[] GetPrimaryKeyTables(string tableName);
        public abstract IDataReader GetReader(QueryCommand cmd);
        public virtual int GetRecordCount(Query qry)
        {
            string str = "SELECT COUNT (1) FROM ";
            if (qry.IsDistinct && !string.IsNullOrEmpty(qry.SelectList))
            {
                string[] strArray = qry.SelectList.Split(new char[] { ',' });
                str = "SELECT COUNT (DISTINCT " + strArray[0] + ") FROM ";
            }
            QueryCommand cmd = BuildSelectCommand(str + Utility.QualifyColumnName(qry.Schema.SchemaName, qry.Schema.Name, qry.Provider) + BuildWhere(qry), qry);
            cmd.CommandType = CommandType.Text;
            object obj2 = this.ExecuteScalar(cmd);
            if (obj2 != null)
            {
                return (int) obj2;
            }
            return 0;
        }

        public abstract string GetSelectSql(Query qry);
        public abstract string[] GetSPList();
        public abstract IDataReader GetSPParams(string spName);
        public abstract string GetSql(Query qry);
        public abstract string GetTableNameByPrimaryKey(string pkName, string providerName);
        public abstract string[] GetTableNameList();
        protected static string[] GetTableNames(DataSet ds)
        {
            int count = ds.Tables.Count;
            string[] strArray = new string[count];
            for (int i = 0; i < count; i++)
            {
                strArray[i] = ds.Tables[i].TableName;
            }
            return strArray;
        }

        public abstract TableSchema.Table GetTableSchema(string tableName, TableType tableType);
        public string GetUpdateSql(Query qry)
        {
            TableSchema.Table schema = qry.Schema;
            string updateSql = "UPDATE " + Utility.QualifyColumnName(schema.SchemaName, schema.Name, qry.Provider) + " SET ";
            string str2 = "";
            bool flag = true;
            foreach (TableSchema.TableColumn column in schema.Columns)
            {
                string columnName = column.ColumnName;
                if (Utility.IsWritableColumn(column))
                {
                    if (!flag)
                    {
                        str2 = str2 + ", ";
                    }
                    flag = false;
                    str2 = str2 + Utility.MakeParameterAssignment(columnName, columnName, qry.Provider);
                }
            }
            updateSql = updateSql + str2;
            if (qry.wheres.Count == 0)
            {
                TableSchema.TableColumn[] primaryKeys = schema.PrimaryKeys;
                updateSql = updateSql + " WHERE ";
                for (int i = 0; i < primaryKeys.Length; i++)
                {
                    updateSql = updateSql + Utility.MakeParameterAssignment(primaryKeys[i].ColumnName, primaryKeys[i].ColumnName, qry.Provider);
                    if ((i + 1) != primaryKeys.Length)
                    {
                        updateSql = updateSql + " AND ";
                    }
                }
                return this.AdjustUpdateSql(qry, schema, updateSql);
            }
            return (updateSql + BuildWhere(qry));
        }

        public abstract string[] GetViewNameList();
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);
            this.connectionStringName = config["connectionStringName"];
            this.additionalNamespaces = Utility.StripWhitespace(this.additionalNamespaces);
            this.excludeProcedureList = Utility.StripWhitespace(this.excludeProcedureList);
            this.excludeTableList = Utility.StripWhitespace(this.excludeTableList);
            this.includeProcedureList = Utility.StripWhitespace(this.includeProcedureList);
            this.includeTableList = Utility.StripWhitespace(this.includeTableList);
            ApplyConfig(config, ref this.appendWith, "appendWith");
            ApplyConfig(config, ref this.additionalNamespaces, "additionalNamespaces");
            ApplyConfig(config, ref this.connectionStringName, "connectionStringName");
            ApplyConfig(config, ref this.excludeProcedureList, "excludeProcedureList");
            ApplyConfig(config, ref this.excludeTableList, "excludeTableList");
            ApplyConfig(config, ref this.extractClassNameFromSPName, "extractClassNameFromSPName");
            ApplyConfig(config, ref this.fixDatabaseObjectCasing, "fixDatabaseObjectCasing");
            ApplyConfig(config, ref this.fixPluralClassNames, "fixPluralClassNames");
            ApplyConfig(config, ref this.generateLazyLoads, "generateLazyLoads");
            ApplyConfig(config, ref this.generateNullableProperties, "generateNullableProperties");
            ApplyConfig(config, ref this.generateODSControllers, "generateODSControllers");
            ApplyConfig(config, ref this.generateRelatedTablesAsProperties, "generateRelatedTablesAsProperties");
            ApplyConfig(config, ref this.generatedNamespace, "generatedNamespace");
            ApplyConfig(config, ref this.includeProcedureList, "includeProcedureList");
            ApplyConfig(config, ref this.includeTableList, "includeTableList");
            ApplyConfig(config, ref this.manyToManySuffix, "manyToManySuffix");
            ApplyConfig(config, ref this.regexDictionaryReplace, "regexDictionaryReplace");
            ApplyConfig(config, ref this.regexIgnoreCase, "regexIgnoreCase");
            ApplyConfig(config, ref this.regexMatchExpression, "regexMatchExpression");
            ApplyConfig(config, ref this.regexReplaceExpression, "regexReplaceExpression");
            ApplyConfig(config, ref this.relatedTableLoadPrefix, "relatedTableLoadPrefix");
            ApplyConfig(config, ref this.removeUnderscores, "removeUnderscores");
            ApplyConfig(config, ref this.setPropertyDefaultsFromDatabase, "setPropertyDefaultsFromDatabase");
            ApplyConfig(config, ref this.spClassName, "spClassName");
            ApplyConfig(config, ref this.spStartsWith, "spStartsWith");
            ApplyConfig(config, ref this.stripColumnText, "stripColumnText");
            ApplyConfig(config, ref this.stripParamText, "stripParamText");
            ApplyConfig(config, ref this.stripSPText, "stripSPText");
            ApplyConfig(config, ref this.stripTableText, "stripTableText");
            ApplyConfig(config, ref this.stripViewText, "stripViewText");
            ApplyConfig(config, ref this.useExtendedProperties, "useExtendedProperties");
            ApplyConfig(config, ref this.useSPs, "useSPs");
            ApplyConfig(config, ref this.viewStartsWith, "viewStartsWith");
        }

        internal DbConnection InitializeSharedConnection()
        {
            if (this.CurrentSharedConnection == null)
            {
                this.CurrentSharedConnection = this.CreateConnection();
            }
            return this.CurrentSharedConnection;
        }

        internal DbConnection InitializeSharedConnection(string sharedConnectionString)
        {
            if (this.CurrentSharedConnection == null)
            {
                this.CurrentSharedConnection = this.CreateConnection(sharedConnectionString);
            }
            return this.CurrentSharedConnection;
        }

        public virtual string MakeParam(string paramName)
        {
            return Utility.PrefixParameter(paramName, this);
        }

        internal void ResetSharedConnection()
        {
            this.CurrentSharedConnection = null;
        }

        public abstract string ScriptData(string tableName);
        public abstract string ScriptData(string tableName, string providerName);
        public abstract string ScriptSchema();
        public void SetDefaultConnectionString(string defaultConnectionString)
        {
            this._defaultConnectionString = defaultConnectionString;
        }

        public abstract void SetParameter(IDataReader rdr, StoredProcedure.Parameter par);

        public string[] AdditionalNamespaces
        {
            get
            {
                string[] strArray = new string[0];
                if (!string.IsNullOrEmpty(this.additionalNamespaces))
                {
                    strArray = this.additionalNamespaces.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                return strArray;
            }
        }

        public string AppendWith
        {
            get
            {
                return this.appendWith;
            }
            set
            {
                this.appendWith = value;
            }
        }

        public string ConnectionStringName
        {
            get
            {
                return this.connectionStringName;
            }
            set
            {
                this.connectionStringName = value;
            }
        }

        public bool CurrentConnectionStringIsDefault
        {
            get
            {
                if ((this.CurrentSharedConnection != null) && (this.CurrentSharedConnection.ConnectionString != this.DefaultConnectionString))
                {
                    return false;
                }
                return true;
            }
        }

        public DbConnection CurrentSharedConnection
        {
            get
            {
                return __sharedConnection;
            }
            protected set
            {
                if (value == null)
                {
                    __sharedConnection.Dispose();
                    __sharedConnection = null;
                }
                else
                {
                    __sharedConnection = value;
                    __sharedConnection.Disposed += new EventHandler(DataProvider.__sharedConnection_Disposed);
                }
            }
        }

        public string DatabaseVersion
        {
            get
            {
                if (string.IsNullOrEmpty(this._databaseVersion))
                {
                    this._databaseVersion = this.GetDatabaseVersion(this.Name);
                }
                return this._databaseVersion;
            }
        }

        public string DefaultConnectionString
        {
            get
            {
                if (string.IsNullOrEmpty(this._defaultConnectionString) && !string.IsNullOrEmpty(this.connectionStringName))
                {
                    try
                    {
                        this._defaultConnectionString = WebConfigurationManager.ConnectionStrings[this.connectionStringName].ConnectionString;
                    }
                    catch
                    {
                        this._defaultConnectionString = "NOT SET";
                    }
                }
                return this._defaultConnectionString;
            }
            set
            {
                this._defaultConnectionString = value;
            }
        }

        public string[] ExcludeProcedures
        {
            get
            {
                string[] strArray = new string[0];
                if (!string.IsNullOrEmpty(this.excludeProcedureList))
                {
                    strArray = this.excludeProcedureList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                return strArray;
            }
        }

        public string[] ExcludeTables
        {
            get
            {
                string[] strArray = new string[0];
                if (!string.IsNullOrEmpty(this.excludeTableList))
                {
                    strArray = this.excludeTableList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                return strArray;
            }
        }

        public bool ExtractClassNameFromSPName
        {
            get
            {
                return this.extractClassNameFromSPName;
            }
            set
            {
                this.extractClassNameFromSPName = value;
            }
        }

        public bool FixDatabaseObjectCasing
        {
            get
            {
                return this.fixDatabaseObjectCasing;
            }
            set
            {
                this.fixDatabaseObjectCasing = value;
            }
        }

        public bool FixPluralClassNames
        {
            get
            {
                return this.fixPluralClassNames;
            }
            set
            {
                this.fixPluralClassNames = value;
            }
        }

        public string GeneratedNamespace
        {
            get
            {
                return this.generatedNamespace;
            }
            set
            {
                this.generatedNamespace = value;
            }
        }

        public bool GenerateLazyLoads
        {
            get
            {
                return this.generateLazyLoads;
            }
            set
            {
                this.generateLazyLoads = value;
            }
        }

        public bool GenerateNullableProperties
        {
            get
            {
                return this.generateNullableProperties;
            }
            set
            {
                this.generateNullableProperties = value;
            }
        }

        public bool GenerateODSControllers
        {
            get
            {
                return this.generateODSControllers;
            }
            set
            {
                this.generateODSControllers = value;
            }
        }

        public bool GenerateRelatedTablesAsProperties
        {
            get
            {
                return this.generateRelatedTablesAsProperties;
            }
            set
            {
                this.generateRelatedTablesAsProperties = value;
            }
        }

        public string[] IncludeProcedures
        {
            get
            {
                string[] strArray = new string[0];
                if (!string.IsNullOrEmpty(this.includeProcedureList))
                {
                    strArray = this.includeProcedureList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                return strArray;
            }
        }

        public string[] IncludeTables
        {
            get
            {
                string[] strArray = new string[0];
                if (!string.IsNullOrEmpty(this.includeTableList))
                {
                    strArray = this.includeTableList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                return strArray;
            }
        }

        public string ManyToManySuffix
        {
            get
            {
                return this.manyToManySuffix;
            }
            set
            {
                this.manyToManySuffix = value;
            }
        }

        public string RegexDictionaryReplace
        {
            get
            {
                return this.regexDictionaryReplace;
            }
            set
            {
                this.regexDictionaryReplace = value;
            }
        }

        public bool RegexIgnoreCase
        {
            get
            {
                return this.regexIgnoreCase;
            }
            set
            {
                this.regexIgnoreCase = value;
            }
        }

        public string RegexMatchExpression
        {
            get
            {
                return this.regexMatchExpression;
            }
            set
            {
                this.regexMatchExpression = value;
            }
        }

        public string RegexReplaceExpression
        {
            get
            {
                return this.regexReplaceExpression;
            }
            set
            {
                this.regexReplaceExpression = value;
            }
        }

        public string RelatedTableLoadPrefix
        {
            get
            {
                return this.relatedTableLoadPrefix;
            }
            set
            {
                this.relatedTableLoadPrefix = value;
            }
        }

        public bool RemoveUnderscores
        {
            get
            {
                return this.removeUnderscores;
            }
            set
            {
                this.removeUnderscores = value;
            }
        }

        public bool SetPropertyDefaultsFromDatabase
        {
            get
            {
                return this.setPropertyDefaultsFromDatabase;
            }
            set
            {
                this.setPropertyDefaultsFromDatabase = value;
            }
        }

        public string SPClassName
        {
            get
            {
                return this.spClassName;
            }
            set
            {
                this.spClassName = value;
            }
        }

        public string SPStartsWith
        {
            get
            {
                return this.spStartsWith;
            }
            set
            {
                this.spStartsWith = value;
            }
        }

        public string StripColumnText
        {
            get
            {
                return this.stripColumnText;
            }
            set
            {
                this.stripColumnText = value;
            }
        }

        public string StripParamText
        {
            get
            {
                return this.stripParamText;
            }
            set
            {
                this.stripParamText = value;
            }
        }

        public string StripSPText
        {
            get
            {
                return this.stripSPText;
            }
            set
            {
                this.stripSPText = value;
            }
        }

        public string StripTableText
        {
            get
            {
                return this.stripTableText;
            }
            set
            {
                this.stripTableText = value;
            }
        }

        public string StripViewText
        {
            get
            {
                return this.stripViewText;
            }
            set
            {
                this.stripViewText = value;
            }
        }

        protected string[] TableNames
        {
            get
            {
                return this.tableNames;
            }
            set
            {
                this.tableNames = value;
            }
        }

        public bool UseExtendedProperties
        {
            get
            {
                return this.useExtendedProperties;
            }
            set
            {
                this.useExtendedProperties = value;
            }
        }

        public bool UseRegexReplace
        {
            get
            {
                if (string.IsNullOrEmpty(this.RegexMatchExpression))
                {
                    return !string.IsNullOrEmpty(this.RegexDictionaryReplace);
                }
                return true;
            }
        }

        public bool UseSPs
        {
            get
            {
                return this.useSPs;
            }
            set
            {
                this.useSPs = value;
            }
        }

        protected string[] ViewNames
        {
            get
            {
                return this.viewNames;
            }
            set
            {
                this.viewNames = value;
            }
        }

        public string ViewStartsWith
        {
            get
            {
                return this.viewStartsWith;
            }
            set
            {
                this.viewStartsWith = value;
            }
        }
    }
}

